package com.louis.resourceloader;


import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.Resource;

/**
 * @author XRY
 * @date 2023年06月29日7:23
 */
public class ResourceLoaderDemo {

    @Test
    public void testClassPathXmlApplicationContext() {
        ApplicationContext context = new ClassPathXmlApplicationContext();
        Resource resources = context.getResource("louis.txt");
        System.out.println(resources.getFilename());
        /*
        * louis.txt
        * */
    }

    @Test
    public void testFileSystemApplicationContext(){
        ApplicationContext context = new FileSystemXmlApplicationContext();
        Resource resource = context.getResource("louis.text");
        System.out.println(resource.getFilename());
        /*
        * louis.text
        * */
    }




}
